const Sequelize = require('sequelize');

import sequelize from './db/sequelize';

/**
 * 单张图片实体
 * type 验证码类型 1.注册验证码 2.手机登陆验证码 3.找回密码验证码 4.绑定手机号验证码 
 */
const VerificationCode = sequelize.define('verification_codes', {
  id                    : {type: Sequelize.BIGINT ,   allowNull: false, primaryKey: true, autoIncrement: true},
  phone                 : {type: Sequelize.STRING ,   allowNull: false },
  code                  : {type: Sequelize.STRING ,   allowNull: false },
  ctime                 : {type: Sequelize.INTEGER ,  allowNull: false },
  status                : {type: Sequelize.INTEGER ,   allowNull: false , defaultValue : 1},
  type                  : {type: Sequelize.INTEGER ,   allowNull: false },
  ext                   : {type: Sequelize.TEXT ,     allowNull: true},
},{
    charset: 'utf8'
});

VerificationCode.sync({force: false}).then(function(){});
export default VerificationCode;